/**
 * 
 */
package sourceFiles;

import Exceptions.InvalidChildID;
import Exceptions.CentralComputerExceptions.ChildIDDoesntExist;
import RideExceptions.ChildNotInRideException;
import RideExceptions.RideActiveException;
import RideExceptions.RideInactiveException;

/**
 * A class representing a simple Exit gate in the park. an exit gate can open,
 * close, and pass a child through it (after a confirmation sequence), and
 * notify the parent RIde that a child want to exit it. Inherited from Gate
 * class.
 * 
 * @author LASO-Team
 * 
 */
public class ExitGate extends Gate {

	/**
	 * A simple constructor for the parameters of the exit gate (a Gate is closed
	 * upon creation)
	 * @param ride
	 *            the ride that the gate is connected to.
	 */
	public ExitGate(IRide ride) {
		super(ride);
	}

	/* (non-Javadoc)
	 * @see sourceFiles.Gate#passThroughGate(java.lang.Integer)
	 */
	@Override
	public void passThroughGate(Integer childID) throws RideInactiveException,
			RideActiveException, InvalidChildID, ChildNotInRideException,
			ChildIDDoesntExist {
		if (!IsGateOpened()) {
			throw new RideInactiveException();
		}
		getRide().childExitsRide(childID);
	}
}
